﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PPI.Entities.Interface;
using PPI.Entities.Kml;

namespace PPI.Entities.Base
{
    public abstract class EGoogleEarth : IGoogleEarth
    {
        public EKmlFile ToKml()
        {
            EKmlFile _file = new EKmlFile();
            _file.KMLCode = GetPlaceMark();
            return _file;
        }

        public bool IsEmpty()
        {
            return false;
        }

        #region Virtual

        public virtual string GetHtmlName()
        {
            throw new NotImplementedException();
        }

        public virtual string GetHtmlPlacemark()
        {
            throw new NotImplementedException();
        }

        protected virtual string GetPlaceMark()
        {
            StringBuilder s = new StringBuilder();
            s.AppendLine("<Placemark id=\"" + GetPlacemarkId() + "\">");
            s.AppendLine(" <Style>");
            s.AppendLine("     <BalloonStyle>");
            s.AppendLine("         <color>F9DDCD</color>");
            s.AppendLine("         <text>$[description]</text>");
            s.AppendLine("     </BalloonStyle>");
            s.AppendLine(" <IconStyle>");
            s.AppendLine("     <Icon>");
            s.AppendLine("         <href>" + GetIcon() + "</href>");
            s.AppendLine("     </Icon>");
            s.AppendLine(" </IconStyle>");
            s.AppendLine("</Style>");
            s.AppendLine(" <name>" + GetHtmlName() + "</name>");
            s.AppendLine(" <description>");
            s.AppendLine("     <![CDATA[" + GetHtmlPlacemark() + "]]>");
            s.AppendLine(" </description>");
            s.AppendLine(GetPositionKML());
            s.AppendLine("</Placemark>");
            return s.ToString();
        }

        public virtual string GetPlacemarkId()
        {
            throw new NotImplementedException();
        }

        public virtual string GetIcon()
        {
            return Constants.K_BASEBLUEICON;
        }

        protected virtual string GetPositionKML()
        {
            throw new NotImplementedException();
        }
        


        #endregion
    }
}
